using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using Entities;
using DAL;
namespace BUS
{
    public class tbDiaDiemBUS
    {
        public static void Insert(tbDiaDiem dd)
        {
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            diadiemDAL.Insert(dd);
        }
        public static void Update(tbDiaDiem dd)
        {
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            diadiemDAL.Update(dd);
        }


        public static void Detele(int iD)
        {
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            diadiemDAL.Delete(iD);
        }


        public static tbDiaDiemCollection Get(string where, int pageIndex, int pageSize, string orderBy, string orderDirection, out int total)
        {
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            return diadiemDAL.Get(where, pageIndex, pageSize, orderBy, orderDirection, out total);
        }


        public static tbDiaDiemCollection GetAll()
        {
            int total = 0;
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            return diadiemDAL.Get("where 1=1", 0, 0, tbDiaDiemColumns.IdDiaDiem.ToString(), "ASC", out total);
        }

        public static tbDiaDiem GetById(int iD)
        {
            int total = 0;
            tbDiaDiemDAL diadiemDAL = new tbDiaDiemDAL();
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbDiaDiemColumns.IdDiaDiem.ToString(), Condition.EQUAL, iD);
            tbDiaDiemCollection diadiemCollection = diadiemDAL.Get(cri .Criter ,0,0,
                                                    tbDiaDiemColumns .IdDiaDiem .ToString (),
                                                    OrderDirection .ASC .ToString (),out total );
            if (diadiemCollection.Count > 0)
                return diadiemCollection[0];
            return null;
        }
    }
}
